import {
	createRouter,
	createWebHashHistory
} from 'vue-router';
import {
	setupPermissions
} from './permissions';
export const constantRoutes = [
	{
		path: '/login',
		name: 'login',
		meta: {
			title: '登录'
		},
		component: () => import('@/views/login/index.vue'),
	},
	{
		path: '/',
		name: 'Main',
		meta: {
			title: '母版'
		},
		component: () => import('@/views/layout/Main.vue'),
		children: [
			{
				path: '/Home',
				name: 'Home',
				meta: {
					title: '首页',
					topTree: '/Home'
				},
				component: () => import('@/views/home/Home.vue'),
			},
			{
				path: '/access/Index',
				name: 'access_Index',
				meta: {
					title: '后台权限'
				},
				component: () =>
					import('@/views/access/Index.vue')
			},
			{
				path: '/shop/Index',
				name: 'shop_Index',
				meta: {
					title: '商城'
				},
				component: () =>import('@/views/shop/Index.vue')
			},
			{
				path: '/password/Index',
				name: 'password_Index',
				meta: {
					title: '修改密码'
				},
				component: () =>import('@/views/password/Index.vue')
			},
			{
				path: '/message/Index',
				name: 'message_Index',
				meta: {
					title: '消息设置'
				},
				component: () =>import('@/views/message/Index.vue')
			},
			{
				path: '/setting/Index',
				name: 'setting_Index',
				meta: {
					title: '系统设置'
				},
				component: () =>import('@/views/setting/index.vue')
			},
			{
				path: '/system/dept/Index',
				name: 'system_dept_Index',
				meta: {
					title: '部门'
				},
				component: () =>import('@/views/system/dept/index.vue')
			},
			{
				path: '/system/user/Index',
				name: 'setting_user_Index',
				meta: {
					title: '用户'
				},
				component: () =>import('@/views/system/user/index.vue')
			},
			{
				path: '/system/role/Index',
				name: 'setting_role_Index',
				meta: {
					title: '角色'
				},
				component: () =>import('@/views/system/role/index.vue')
			},
			{
				path: '/stock/Index',
				name: 'stock_Index',
				meta: {
					title: '管理仓库'
				},
				component: () =>import('@/views/stock/index.vue')
			},
			{
				path: '/bank/bank/Index',
				name: 'bank_bank_Index',
				meta: {
					title: '银行'
				},
				component: () =>import('@/views/bank/bank/index.vue')
			},
			{
				path: '/bank/branch/Index',
				name: 'bank_branch_Index',
				meta: {
					title: '银行支行'
				},
				component: () =>import('@/views/bank/branch/index.vue')
			},
			{
				path: '/bank/account/Index',
				name: 'bank_account_Index',
				meta: {
					title: '银行账户'
				},
				component: () =>import('@/views/bank/account/index.vue')
			},
			{
				path: '/client/client/Index',
				name: 'client_client_Index',
				meta: {
					title: '客户管理'
				},
				component: () =>import('@/views/client/client/index.vue')
			},
			{
				path: '/systmp/tmp/Index',
				name: 'systmp_tmp_Index',
				meta: {
					title: '系统模版设置'
				},
				component: () =>import('@/views/systmp/tmp/index.vue')
			},
			{
				path: '/store/store/Index',
				name: 'store_store_Index',
				meta: {
					title: '系统模版设置'
				},
				component: () =>import('@/views/store/store/index.vue')
			},
			{
				path: '/store/tags/Index',
				name: 'store_tags_Index',
				meta: {
					title: '系统模版设置'
				},
				component: () =>import('@/views/store/tags/index.vue')
			},
			{
				path: '/product/units/Index',
				name: 'product_units_Index',
				meta: {
					title: '计量单位'
				},
				component: () =>import('@/views/product/units/index.vue')
			},
			{
				path: '/product/proclass/Index',
				name: 'product_proclass_Index',
				meta: {
					title: '产品分类'
				},
				component: () =>import('@/views/product/proclass/index.vue')
			},
			{
				path: '/product/product/Index',
				name: 'product_product_Index',
				meta: {
					title: '产品'
				},
				component: () =>import('@/views/product/product/index.vue')
			},
			{
				path: '/bill/bill/Index',
				name: 'bill_bill_Index',
				meta: {
					title: '账单'
				},
				component: () =>import('@/views/bill/bill/index.vue')
			},
			{
				path: '/bill/bill/Add',
				name: 'bill_bill_Add',
				meta: {
					title: '账单添加'
				},
				component: () =>import('@/views/bill/bill/add.vue')
			},
			{
				path: '/bill/bill/Edit',
				name: 'bill_bill_Edit',
				meta: {
					title: '账单编辑'
				},
				component: () =>import('@/views/bill/bill/edit.vue')
			},
			{
				path: '/bill/receipt/Index',
				name: 'bill_receipt_Index',
				meta: {
					title: '收据'
				},
				component: () =>import('@/views/bill/receipt/index.vue')
			},
			{
				path: '/bill/receipt/Add',
				name: 'bill_receipt_Add',
				meta: {
					title: '收据添加'
				},
				component: () =>import('@/views/bill/receipt/add.vue')
			},
			{
				path: '/bill/receipt/Edit',
				name: 'bill_receipt_Edit',
				meta: {
					title: '收据编辑'
				},
				component: () =>import('@/views/bill/receipt/edit.vue')
			},
			{
				path: '/bill/pricesheet/Index',
				name: 'bill_pricesheet_Index',
				meta: {
					title: '报价单'
				},
				component: () =>import('@/views/bill/pricesheet/index.vue')
			},
			{
				path: '/bill/pricesheet/Add',
				name: 'bill_pricesheet_Add',
				meta: {
					title: '报价单添加'
				},
				component: () =>import('@/views/bill/pricesheet/add.vue')
			},
			{
				path: '/bill/pricesheet/Edit',
				name: 'bill_pricesheet_Edit',
				meta: {
					title: '报价单编辑'
				},
				component: () =>import('@/views/bill/pricesheet/edit.vue')
			},
			{
				path: '/bill/deliveryorder/Index',
				name: 'bill_deliveryorder_Index',
				meta: {
					title: '交货单'
				},
				component: () =>import('@/views/bill/deliveryorder/index.vue')
			},
			{
				path: '/bill/deliveryorder/Add',
				name: 'bill_deliveryorder_Add',
				meta: {
					title: '交货单添加'
				},
				component: () =>import('@/views/bill/deliveryorder/add.vue')
			},
			{
				path: '/bill/deliveryorder/Edit',
				name: 'bill_deliveryorder_Edit',
				meta: {
					title: '交货单编辑'
				},
				component: () =>import('@/views/bill/deliveryorder/edit.vue')
			},
			{
				path: '/bill/orderblank/Index',
				name: 'bill_orderblank_Index',
				meta: {
					title: '订货单'
				},
				component: () =>import('@/views/bill/orderblank/index.vue')
			},
			{
				path: '/bill/orderblank/Add',
				name: 'bill_orderblank_Add',
				meta: {
					title: '订货单'
				},
				component: () =>import('@/views/bill/orderblank/add.vue')
			},
			{
				path: '/bill/orderblank/Edit',
				name: 'bill_orderblank_Edit',
				meta: {
					title: '订货单'
				},
				component: () =>import('@/views/bill/orderblank/edit.vue')
			},
			{
				path: '/stockcontrol/pricespread/Index',
				name: 'stockcontrol_pricespread_Index',
				meta: {
					title: '订货单'
				},
				component: () =>import('@/views/stockcontrol/pricespread/index.vue')
			},
			{
				path: '/stockcontrol/loss/Index',
				name: 'stockcontrol_loss_Index',
				meta: {
					title: '订货单'
				},
				component: () =>import('@/views/stockcontrol/loss/index.vue')
			},
			{
				path: '/stockcontrol/takestock/Index',
				name: 'stockcontrol_takestock_Index',
				meta: {
					title: '订货单'
				},
				component: () =>import('@/views/stockcontrol/takestock/index.vue')
			},
		]
	},
];
const router = createRouter({
	history: createWebHashHistory(),
	routes: constantRoutes,
});
export function setupRouter(app) {
	setupPermissions(router);
	app.use(router);
	return router;
}

export default router;
